<template>
  <div class="app-container">
    <!--  搜索框 开始  -->
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="small"
      :inline="true"
      v-show="showSearch"
      label-width="85px"
    >
      <el-form-item label="关键字" prop="orgName"> 
        <el-input
          v-model="queryParams.orgName"
          placeholder="请输入组织名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学期" prop="orgName">
        <el-select v-model="queryParams.schoolYear" placeholder="请选择学期">
          <el-option
            v-for="option in schoolYears"
            :key="option.schoolYearId"
            :label="option.schoolYearId"
            :value="option.schoolYearId"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="社团联盟" prop="classNo">
        <el-select
          v-model="queryParams.classNo"
          placeholder="请选择"
          clearable
          style="width: 240px"
        >
          <el-option
            v-for="value in classNoMapList"
            :key="value[0]"
            :label="value[1]"
            :value="value[0]"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="指导单位" prop="units">
        <el-select v-model="queryParams.units" placeholder="请选择" clearable size="small">
          <el-option
            v-for="(dict, index) in unitNameList"
            :key="index"
            :label="dict.sponsorName"
            :value="dict.sponsorName"
          />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="组织名称" prop="orgName">
        <el-input
          v-model="queryParams.orgName"
          placeholder="请输入组织名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学生管理员" prop="studentManage">
        <el-input
          v-model="queryParams.studentManage"
          placeholder="请输入学生管理员"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="学号" prop="studentId">
        <el-input
          v-model="queryParams.studentId"
          placeholder="请输入学号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item> -->
      <el-form-item label="状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
          <el-option
            v-for="dict in dict.type.sys_recruit_state"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="small" @click="handleQuery">查询</el-button>
        <el-button size="small" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <!--  搜索框 结束  -->

    <!--  操作按钮 开始  -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-document"
          size="small"
          @click="handleApply"
          v-hasPermi="['hd:recruit:add']"
          >纳新申请
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-document"
          size="small"
          @click="submitFormBatch"
          v-hasPermi="['hd:recruit:check']"
          >批量审核
        </el-button>
      </el-col>
      <!--      <el-col :span="1.5">-->
      <!--      <el-button-->
      <!--        type="warning"-->
      <!--        plain-->
      <!--        icon="el-icon-download"-->
      <!--        size="mini"-->
      <!--        @click="handleExport"-->
      <!--        v-hasPermi="['hd:recruit:export']"-->
      <!--      >导出</el-button>-->
      <!--      </el-col>-->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <!--  操作按钮 结束  -->

    <!--  表格 开始  -->
    <el-table
      v-loading="loading"
      border
      :data="recruitList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <!--      <el-table-column label="序号" align="center" prop="id" />-->
      <el-table-column label="组织名称" align="center" prop="orgName" />
      <el-table-column label="指导单位" align="center" prop="units" />
      <el-table-column label="指导老师" align="center">
        <template slot-scope="scope">
          {{ scope.row.teacherName }}<br />{{ scope.row.teacherId }}
        </template>
      </el-table-column>
      <el-table-column label="学生管理员" align="center">
        <template slot-scope="scope">
          {{ scope.row.studentManage }}<br />{{ scope.row.studentId }}
        </template>
      </el-table-column>
      <el-table-column label="联盟类型" align="center" prop="classNo">
        <template slot-scope="scope">
          {{ scope.row.classNo | classNoMap }}
        </template>
      </el-table-column>
      <el-table-column label="拟招人数" align="center" prop="planPeopleNum" />
      <el-table-column label="招新群号" align="center" prop="qqGroupNum" />
      <el-table-column label="海报" align="center" prop="postId">
        <template slot-scope="scope">
          <el-image
            v-if="scope.row.postId"
            style="width: 100px; height: 100px"
            :src="scope.row.postId"
            :preview-src-list="[scope.row.postId]"
            fit="cover"
          >
          </el-image>
        </template>
      </el-table-column>
      <!-- <el-table-column label="学生管理员" align="center" prop="studentManage" />
      <el-table-column label="学号" align="center" prop="studentId" /> -->
      <el-table-column type="button" label="简介" width="200" max-height="300" align="center">
        <template slot-scope="scope">
          <div
            class="myNote"
            style="margin: -14px 0"
            v-html="imgStyle(scope.row.orgIntroduce)"
          ></div>
        </template>
      </el-table-column>
      <el-table-column type="button" label="状态" align="center" prop="status">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_recruit_state" :value="scope.row.status" />
        </template>
      </el-table-column>
      <el-table-column
        label="操作"
        width="330px;"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="small"
            type="primary"
            icon="el-icon-edit"
            @click="edit(scope.row)"
            v-hasPermi="['hd:recruit:edit']"
            >修改</el-button
          >
          <!-- :disabled="!roles.includes('common') && scope.row.status != 2" -->
          <el-button size="small" type="primary" icon="el-icon-view" @click="look(scope.row)"
            >查看</el-button
          >
          <el-button
            size="small"
            type="primary"
            icon="el-icon-edit-outline"
            @click="audit(scope.row)"
            v-hasPermi="['hd:recruit:check']"
            :disabled="scope.row.status != 0 || scope.row.status == 3"
            >审核</el-button
          >
          <el-button
            size="small"
            type="primary"
            icon="el-icon-s-grid"
            @click="code(scope.row)"
            :disabled="scope.row.status != 1 || scope.row.status == 3"
            v-hasPermi="['hd:recruit:QRCode']"
            >二维码</el-button
          >
          <el-button
            size="small"
            type="primary"
            icon="el-icon-upload"
            @click="handleImport(scope.row.orgId)"
            :disabled="scope.row.status != 1 || scope.row.status == 3"
            v-hasPermi="['hd:recruit:import']"
            >导入名单</el-button
          >
          <el-button
            style="padding: 8px; margin: 10px"
            type="danger"
            size="mini"
            v-hasPermi="['hd:recruit:stopRecruit']"
            @click="stopRecruit(scope.row.id, scope.row.orgName)"
          >
            停止招新
          </el-button>
          <el-button
            style="padding: 8px; margin: 10px"
            type="danger"
            size="mini"
            v-hasPermi="['hd:recruit:remove']"
            @click="handleDelete(scope.row.id, scope.row.orgName)"
          >
            删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!--  表格 结束  -->

    <!-- 申请 对话框 -->
    <el-dialog title="纳新申请" :visible.sync="open1" width="800px">
      <el-form ref="form1" :model="form1" :rules="rules" label-width="100px" class="form1">
        <el-row>
          <el-col :span="12">
            <el-form-item label="学号">
              <!--prop="studentId"-->
              <!--              <el-input v-model="form1.studentId" placeholder="请输入学号" style="width: 200px;"/>-->
              <div>{{ form1.studentId }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="管理员">
              <!--prop="studentManage"-->
              <!--              <el-input v-model="form1.studentManage" placeholder="请输入管理员" style="width: 200px;"/>-->
              <div>{{ form1.studentManage }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="组织名称" prop="orgName">
              <!--prop="orgName"-->
              <!--              <el-input v-model="form1.orgName" placeholder="请输入组织名称" style="width: 200px;"/>-->
              <!--              <div>{{form1.orgName}}</div>-->

              <el-select
                v-model="form1.orgName"
                remote
                reserve-keyword
                filterable
                :remote-method="orgInfoArrList"
                @change="addChangeOrg"
                placeholder="请选择组织名称1"
                :loading="searchLoading"
                style="width: 200px"
              >
                <el-option
                  v-for="(item, index) in orgInfoArr"
                  :key="index"
                  :label="item.orgName"
                  :value="item"
                >
                </el-option>
              </el-select>

              <!-- <el-select
            v-model="form.username"
            remote
            reserve-keyword
            filterable
            :remote-method="remoteTeacher"
            placeholder="请输入关键词"
            :loading="searchLoading"
          >
            <el-option
              v-for="(item, index) in teacherOptions"
              :key="index"
              :label="item.xh + '--' + item.xm"
              :value="item.xh"
            >
            </el-option> -->
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="指导单位" prop="units">
              <!--prop="units"-->
              <!--              <el-input v-model="form1.units" placeholder="请输入指导单位" style="width: 200px;"/>-->
              <!--              <div>{{form1.units}}</div>-->

              <el-select
                disabled
                v-model="form1.units"
                placeholder="请选择指导单位"
                style="width: 200px"
              >
                <div v-for="(org, index) in sponsorInfoArr" :key="index">
                  <el-option :label="org.sponsorName" :value="org.sponsorName" />
                </div>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="指导老师" prop="teacherId">
              <el-select
                disabled
                v-model="form1.teacherId"
                remote
                reserve-keyword
                filterable
                :remote-method="remoteTeacher"
                placeholder="请输入关键词"
                :loading="searchLoading"
              >
                <el-option
                  v-for="(item, index) in teacherOptions"
                  :key="index"
                  :label="item.xh + '--' + item.xm"
                  :value="item.xh"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联盟类型" prop="classNo">
              <el-select
                disabled
                v-model="form1.classNo"
                placeholder="请选择"
                clearable
                style="width: 200px"
              >
                <el-option
                  v-for="value in classNoMapList"
                  :key="value[0]"
                  :label="value[1]"
                  :value="value[0]"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="拟招人数" prop="planPeopleNum">
              <el-input
                v-model="form1.planPeopleNum"
                placeholder="请输入拟招收人数"
                style="width: 200px"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="招新群号" prop="qqGroupNum">
              <el-input
                v-model="form1.qqGroupNum"
                placeholder="请输入招新群号"
                style="width: 200px"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="部门" prop="departOption">
          <el-input v-model="form1.departOption" placeholder="请输入" style="width: 200px" /><span
            style="color: #999"
          >
            请以'、'分割，例如：办公室、组织部、宣传技术部。</span
          >
        </el-form-item>
        <el-form-item label="标签" prop="feature">
          <el-input v-model="form1.feature" placeholder="请输入标签" style="width: 200px" /><span
            style="color: #999"
          >
            请以' #'分割，例如：机器人 #实验。</span
          >
          <!-- <el-input v-model="form1.feature2" placeholder="请输入标签2" style="width: 200px" /> -->
        </el-form-item>
        <el-form-item label="海报" prop="postId">
          <el-upload
            style="width: 80%"
            :action="uploadFileUrl"
            :limit="1"
            list-type="picture"
            :on-change="changePostIdImage"
            :on-remove="removePostIdImage"
            :on-error="handleUploadError"
            :on-success="handleUploadSuccess"
            :file-list="postIdFileList"
          >
            <el-button size="small" type="primary">点击上传</el-button
            ><span style="color: #999"> 图片推荐分辨率195*264，等比例放大缩小</span>
          </el-upload>
        </el-form-item>
        <el-form-item label="详情海报" prop="postIdDetail">
          <el-upload
            style="width: 80%"
            :action="uploadFileUrl"
            :limit="1"
            list-type="picture"
            :on-change="changePostIdImage2"
            :on-remove="removePostIdImage"
            :on-error="handleUploadError"
            :on-success="handleUploadSuccess"
            :file-list="postIdFileList2"
          >
            <el-button size="small" type="primary">点击上传</el-button
            ><span style="color: #999"> 图片推荐分辨率680*290，等比例放大缩小</span>
          </el-upload>
        </el-form-item>
        <el-col :span="24">
          <el-form-item label="简介" prop="orgIntroduce">
            <ckeditor v-model="form1.orgIntroduce" :config="editorConfig"></ckeditor>
            <!-- <div id="richText"></div> -->
          </el-form-item>
        </el-col>
        <!-- <el-form-item label="工作介绍" prop="orgWorkIntroduce">
          <div id="richText2"></div>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm1">提 交</el-button>
        <el-button @click="cancel1">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 修改 对话框 -->
    <el-dialog title="纳新修改" :visible.sync="open2" width="800px">
      <el-form ref="form2" :model="form2" :rules="rules" label-width="100px">
        <div style="padding-bottom: 30px; font-size: 17px; font-weight: 600">
          拒绝理由：{{ form2.remark }}
        </div>

        <el-row>
          <el-col :span="24">
            <el-form-item label="组织名称">
              <div>{{ form2.orgName }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="指导单位">
              <div>{{ form2.units }}</div>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
          <el-form-item label="指导老师" prop="teacherId">
            <el-select
              v-model="form2.teacherId"
              remote
              reserve-keyword
              filterable
              :remote-method="remoteTeacher"
              placeholder="请输入关键词"
              :loading="searchLoading"
            >
              <el-option
                v-for="(item, index) in teacherOptions"
                :key="index"
                :label="item.xh + '--' + item.xm"
                :value="item.xh"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="联盟类型" prop="classNo">
            <el-select v-model="form2.classNo" placeholder="请选择" clearable style="width: 200px">
              <el-option
                v-for="value in classNoMapList"
                :key="value[0]"
                :label="value[1]"
                :value="value[0]"
              />
            </el-select>
          </el-form-item>
        </el-col> -->
          <el-col :span="11">
            <el-form-item label="拟招人数" prop="planPeopleNum">
              <el-input
                v-model="form2.planPeopleNum"
                placeholder="请输入拟招收人数"
                style="width: 200px"
              />
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="招新群号" prop="qqGroupNum">
              <el-input
                v-model="form2.qqGroupNum"
                placeholder="请输入招新群号"
                style="width: 200px"
              />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="部门" prop="departOption">
              <el-input
                v-model="form2.departOption"
                placeholder="请输入"
                style="width: 200px"
              /><span style="color: #999"> 请以'、'分割，例如：办公室、组织部、宣传技术部。</span>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="标签" prop="feature">
              <el-input v-model="form2.feature" placeholder="请输入标签1" style="width: 200px" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="海报" prop="postId">
          <el-upload
            style="width: 80%"
            :action="uploadFileUrl"
            :limit="1"
            list-type="picture"
            :on-change="changePostIdImage"
            :on-remove="removePostIdImage"
            :on-error="handleUploadError"
            :on-success="handleUploadSuccess"
            :file-list="postIdFileList"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-form-item label="详情海报" prop="postIdDetail">
          <el-upload
            style="width: 80%"
            :action="uploadFileUrl"
            :limit="1"
            list-type="picture"
            :on-change="changePostIdImage2"
            :on-remove="removePostIdImage2"
            :on-error="handleUploadError"
            :on-success="handleUploadSuccess"
            :file-list="postIdFileList2"
          >
            <el-button size="small" type="primary">点击上传</el-button>
          </el-upload>
        </el-form-item>
        <el-form-item label="简介" prop="orgIntroduce">
          <ckeditor v-model="form2.orgIntroduce" :config="editorConfig"></ckeditor>
          <!-- <div id="richText3"></div> -->
        </el-form-item>

        <!-- <el-form-item label="工作介绍" prop="orgWorkIntroduce">
          <div id="richText4"></div>
        </el-form-item> -->
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm2">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 查看 对话框 -->
    <el-dialog title="纳新查看" :visible.sync="open2_1" width="700px" append-to-body>
      <el-form ref="form2_1" :model="form2_1" :rules="rules" label-width="100px">
        <el-form-item label="组织名称">
          <div>{{ form2_1.orgName }}</div>
        </el-form-item>
        <el-form-item label="指导单位">
          <div>{{ form2_1.units }}</div>
        </el-form-item>
        <el-row>
          <el-col :span="12">
            <el-form-item label="指导老师">
              <div>{{ form2_1.teacherName }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学生管理员">
              <div>{{ form2_1.studentManage }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="联盟类型">
              <div>{{ form2_1.classNo | classNoMap }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="标签">
              <div>#{{ form2_1.feature }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="拟招人数">
              <div>{{ form2_1.planPeopleNum }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="招新群号">
              <div>{{ form2_1.qqGroupNum }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="部门">
            <div>{{ form2_1.departOption }}</div>
          </el-form-item>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="海报">
              <div>
                <el-image
                  style="width: 100px; height: 100px"
                  v-if="form2_1.postId"
                  :src="form2_1.postId"
                  :preview-src-list="[form2_1.postId]"
                  fit="cover"
                >
                </el-image>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="详情海报">
              <div>
                <el-image
                  style="width: 100px; height: 100px"
                  v-if="form2_1.postIdDetail"
                  :src="form2_1.postIdDetail"
                  :preview-src-list="[form2_1.postIdDetail]"
                  fit="cover"
                >
                </el-image>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-col :span="24">
          <el-form-item label="简介">
            <div style="margin: -14px 0" v-html="imgStyle(form2_1.orgIntroduce)"></div>
            <!-- <el-button type="text" @click="view(form2_1.orgIntroduce)">查看架构介</el-button> -->
          </el-form-item>
        </el-col>
        <!-- <el-form-item label="工作介绍">
          <el-button type="text" @click="view2(form2_1.orgWorkIntroduce)">查看工作介绍</el-button>
        </el-form-item> -->
        <el-form-item label="审核结果">
          <!--          <el-select v-model="form2_1.status" placeholder="请选择审核结果" disabled style="width: 200px;">-->
          <!--            <el-option label="等待审核" value="0"/>-->
          <!--            <el-option label="审核通过" value="1"/>-->
          <!--            <el-option label="审核拒绝" value="2"/>-->
          <!--          </el-select>-->
          <div v-if="form2_1.status == 0 ? true : false">等待审核</div>
          <div v-if="form2_1.status == 1 ? true : false">审核通过</div>
          <div v-if="form2_1.status == 2 ? true : false">审核拒绝</div>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel2_1">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 审核 对话框 -->
    <el-dialog title="纳新审核" :visible.sync="open3" width="700px" append-to-body>
      <el-form ref="form3" :model="form3" :rules="rules" label-width="100px">
        <el-form-item label="组织名称">
          <div>{{ form3.orgName }}</div>
        </el-form-item>
        <el-form-item label="指导单位">
          <div>{{ form3.units }}</div>
        </el-form-item>
        <el-row>
          <el-col :span="12">
            <el-form-item label="指导老师">
              <div>{{ form3.teacherName }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="学生管理员">
              <div>{{ form3.studentManage }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="联盟类型">
              <div>{{ form3.classNo | classNoMap }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="标签">
              <div>#{{ form3.feature }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="拟招人数">
              <div>{{ form3.planPeopleNum }}</div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="招新群号">
              <div>{{ form3.qqGroupNum }}</div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="部门">
            <div>{{ form3.departOption }}</div>
          </el-form-item>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="海报">
              <div>
                <el-image
                  style="width: 100px; height: 100px"
                  v-if="form3.postId"
                  :src="form3.postId"
                  :preview-src-list="[form3.postId]"
                  fit="cover"
                >
                </el-image>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="详情海报">
              <div>
                <el-image
                  style="width: 100px; height: 100px"
                  v-if="form3.postIdDetail"
                  :src="form3.postIdDetail"
                  :preview-src-list="[form3.postIdDetail]"
                  fit="cover"
                >
                </el-image>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="简介">
          <div style="margin: -14px 0" v-html="imgStyle(form3.orgIntroduce)"></div>
        </el-form-item>
        <!-- <el-form-item label="工作介绍">
          <template>
            <el-button type="text" @click="view4(form3.orgWorkIntroduce)">查看工作介绍</el-button>
          </template>
        </el-form-item> -->
        <!----------------------------------------------------------------->
        <el-form-item label="审核结果" prop="audit">
          <el-select v-model="form3.checks" placeholder="请选择审核结果" style="width: 180px">
            <el-option label="审核通过" value="1" />
            <el-option label="审核拒绝" value="2" />
          </el-select>
        </el-form-item>
        <el-form-item label="拒绝理由" v-if="form3.checks == 2" prop="remarks">
          <el-input v-model="form3.remarks" type="textarea" placeholder="请输入拒绝理由" />
        </el-form-item>
        <!----------------------------------------------------------------->
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm3">确 定</el-button>
        <el-button @click="cancel3">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 富文本 对话框 -->
    <el-dialog title="组织架构介绍" :visible.sync="open4" width="600px" append-to-body>
      <el-card>
        <div v-html="content1"></div>
      </el-card>
    </el-dialog>
    <el-dialog title="组织主要工作介绍" :visible.sync="open5" width="600px" append-to-body>
      <el-card>
        <div v-html="content2"></div>
      </el-card>
    </el-dialog>
    <el-dialog title="组织架构介绍" :visible.sync="open6" width="600px" append-to-body>
      <el-card>
        <div v-html="content3"></div>
      </el-card>
    </el-dialog>
    <el-dialog title="组织主要工作介绍" :visible.sync="open7" width="600px" append-to-body>
      <el-card>
        <div v-html="content4"></div>
      </el-card>
    </el-dialog>
    <!-- 批量处理对话框 -->
    <el-dialog :title="title" :visible.sync="open8" width="600px" append-to-body>
      <el-form ref="form3" :model="form3" :rules="rules" label-width="120px">
        <el-form-item label="审核结果" prop="audit">
          <el-select v-model="form3.checks" placeholder="请选择审核结果">
            <el-option label="审核通过" value="1" />
            <el-option label="审核拒绝" value="2" />
          </el-select>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm3(1)">确 定</el-button>
        <el-button @click="cancel2">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改纳新申请对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="学生管理员" prop="studentManage">
          <el-input v-model="form.studentManage" placeholder="请输入学生管理员" />
        </el-form-item>
        <el-form-item label="学号" prop="studentId">
          <el-input v-model="form.studentId" placeholder="请输入学号" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 二维码对话框 -->
    <el-dialog :title="title + '报名表'" :visible.sync="QRCode" width="380px" append-to-body>
      <el-card>
        <el-image
          v-if="QRCodeImage"
          style="width: 300px; height: 300px"
          :src="QRCodeImage"
          :preview-src-list="[QRCodeImage]"
          fit="cover"
        >
        </el-image>
        <el-button type="primary" @click="openUrl(QRCodeImage, title)">点击下载</el-button>
      </el-card>
    </el-dialog>

    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="
          upload.url + '?updateSupport=' + upload.updateSupport + '&orgId=' + upload.orgId
        "
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link
            type="primary"
            :underline="false"
            style="font-size: 12px; vertical-align: baseline"
            @click="importTemplate"
            >下载模板</el-link
          >
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from 'vuex';
import E from 'wangeditor';
let editor;
let editor2;
let editor3;
let editor4;

import {
  GetYearList,
  listRecruit,
  getRecruit,
  stopRecruit,
  delRecruit,
  addRecruit,
  updateRecruit,
  RecruitApply,
  RecruitDetailsEdit,
  RecruitStateEdit,
  showQrCode,
  updateStatusBatch,
  updateStatus,
  FindNickName,
  FindOrgInfoByDetail,
  FindOrgInfoByStudentId,
  FindSponsorInfoByStudentId,
  canChooseTeacherList,
  downloadImgs,
} from '@/api/hd/recruit';
import { listSponsor } from "@/api/system/sponsor";
import { getToken } from '@/utils/auth';
import { classNoMap } from '@/views/approval/enum';
import CKEditor from 'ckeditor4-vue';
import { GetUrlString } from '@/utils/string';
export default {
  inject: ['reload'],
  name: 'Recruit',
  components: {
    ckeditor: CKEditor.component,
  },
  dicts: ['sys_recruit_state'],
  computed: {
    ...mapGetters(['roles', 'name', 'userName']),
  },
  filters: {
    classNoMap: function (value) {
      return classNoMap.get(value);
    },
  },
  data() {
    return {
      searchLoading: false,
      content1: '',
      content2: '',
      content3: '',
      content4: '',
      editorConfig: {},
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 纳新申请表格数据
      recruitList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      open1: false,
      open2: false,
      open2_1: false,
      open3: false,
      open4: false,
      open5: false,
      open6: false,
      open7: false,
      open8: false,
      // 二维码
      QRCode: false,
      QRCodeImage: '',
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        clubName: null,
        orgName: null,
        studentManage: null,
        studentId: null,
        status: null,
      },
      // 表单参数
      form: {},
      form1: {
        studentId: '',
        studentManage: '',
        orgName: '',
        units: '',
        teacherId: '',
        calssNo: null,
        planPeopleNum: '',
        qqGroupNum: '',
        departOption: '',
        feature: '',
        postId: '',
        postIdDetail: '',
        orgIntroduce: '',
      },
      orgInfoArr: [],
      sponsorInfoArr: [],
      unitNameList: [],
      orgId: '',
      form2: {
        orgName: '',
        units: '',
        teacherId: '',
        calssNo: null,
        joinPeopleNum: 0,
        planPeopleNum: 0,
        qqGroupNum: '',
        departOption: '',
        feature: '',
        orgIntroduce: '',
        orgWorkIntroduce: '',
        status: '',
        postId: '',
        postIdDetail: '',
      },
      form2_1: {
        orgName: '',
        units: '',
        joinPeopleNum: 0,
        planPeopleNum: 0,
        qqGroupNum: '',
        departOption: '',
        orgIntroduce: '',
        orgWorkIntroduce: '',
        status: '',
        calssNo: null,
        postId: '',
        postIdDetail: '',
        teacherId: '',
        feature: '',
      },
      form3: {
        orgName: '',
        units: '',
        teacherId: '',
        calssNo: null,
        joinPeopleNum: 0,
        planPeopleNum: 0,
        qqGroupNum: '',
        departOption: '',
        orgIntroduce: '',
        orgWorkIntroduce: '',
        status: '',
        id: '',
        checks: null,
        remarks: '',
        feature: '',
        postId: '',
        postIdDetail: '',
      },
      // 表单校验
      rules: {
        clubName: [{ required: true, message: '社团名称不能为空', trigger: 'blur' }],
        studentManage: [{ required: true, message: '学生管理员不能为空', trigger: 'blur' }],
        studentId: [{ required: true, message: '学号不能为空', trigger: 'blur' }],
        orgName: [{ required: true, message: '组织名称不能为空', trigger: 'blur' }],
        // units: [{ required: true, message: '指导单位不能为空', trigger: 'blur' }],
        joinPeopleNum: [{ required: true, message: '现有人数不能为空', trigger: 'blur' }],
        planPeopleNum: [{ required: true, message: '拟招收人数不能为空', trigger: 'blur' }],
        qqGroupNum: [{ required: true, message: '招新群号不能为空', trigger: 'blur' }],
        departOption: [{ required: true, message: '部门不能为空', trigger: 'blur' }],
        feature: [{ required: true, message: '标签不能为空', trigger: 'blur' }],
        postId: [{ required: true, message: '海报不能为空', trigger: 'blur' }],
        postIdDetail: [{ required: true, message: '详情海报不能为空', trigger: 'blur' }],
        remarks: [{ required: true, message: '审核理由不能为空', trigger: 'blur' }],
        orgIntroduce: [{ required: true, message: '简介不能为空', trigger: 'blur' }],
        orgWorkIntroduce: [{ required: true, message: '工作介绍不能为空', trigger: 'blur' }],
      },
      // 学期选项
      schoolYears: [],
      // 社团联盟选项
      classNoMapList: [],
      // 指导老师选项
      teacherOptions: [],
      // 海报
      postIdFileList: [],
      postIdFileList2: [],
      uploadFileUrl: process.env.VUE_APP_BASE_API + '/api/images/uploadLocal',

      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: '',
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: 'Bearer ' + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + '/hd/apply/importData',
        orgId:'',
      },
    };
  },
  created() {
    GetYearList().then(response => {
      console.log(response, 'Years');
      this.schoolYears = response.rows;
    });
    listSponsor().then(response => {
      this.unitNameList = response.rows;
    });
    this.classNoMapList = classNoMap;
    this.getList();
    this.orgInfoArrList();
  },
  methods: {
    // 显示富文本内容
    imgStyle(val) {
      if (val != '' && val != undefined && val != null) {
        return val?.replace(
          /<img/g,
          '<img style="max-width: 100%!important;display: block;margin: 0 auto;"'
        );
      } else {
        console.log(val, '88899');
        return val;
      }
    },
    /** 查询老师 */
    remoteTeacher(query) {
      if (query !== '') {
        this.searchLoading = true;
        canChooseTeacherList(query).then(response => {
          console.log(response);
          this.searchLoading = false;
          this.teacherOptions = response.rows;
        });
      } else {
        this.teacherOptions = [];
      }
    },
    /** 架构介绍和工作介绍详情 */
    view(orgIntroduce) {
      this.content1 = orgIntroduce;
      this.open4 = true;
    },
    view2(orgWorkIntroduce) {
      this.content2 = orgWorkIntroduce;
      this.open5 = true;
    },
    view3(orgIntroduce) {
      this.content3 = orgIntroduce;
      this.open6 = true;
    },
    view4(orgWorkIntroduce) {
      this.content4 = orgWorkIntroduce;
      this.open7 = true;
    },
    /** 表单取消 */
    cancel() {
      this.open = false;
      this.reset();
    },
    cancel1() {
      // 清除内容
      // editor.txt.html('');
      // editor2.txt.html('');
      this.open1 = false;
      this.reset1();
    },
    cancel2() {
      this.open2 = false;
      this.open8 = false;
      this.reset2();
      this.reload();
      this.getList();
    },
    cancel2_1() {
      this.open2_1 = false;
    },
    cancel3() {
      this.reset3();
      this.open3 = false;
      this.getList();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: null,
        clubName: null,
        studentManage: null,
        studentId: null,
        status: '0',
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
      };
      // this.resetForm('form');
    },
    reset1() {
      this.resetForm('form1');
      this.postIdFileList = [];
      this.postIdFileList2 = [];
    },
    reset2() {
      this.resetForm('form2');
    },
    reset3() {
      this.form3 = {
        checks: null,
        remarks: null,
      };
      // this.resetForm('form3');
    },
    /** 查询纳新申请列表 */
    getList() {
      this.loading = true;
      listRecruit(this.queryParams).then(response => {
        for (let i = 0; i < response.rows.length; i++) {
          // var a = response.rows[i].postId.indexOf('name');
          if (response.rows[i].postId && response.rows[i].postId.indexOf('name') == -1) {
            response.rows[i].postId =
              process.env.VUE_APP_BASE_API + '/api/images/showLocal?name=' + response.rows[i].postId;
          }
          if (
            response.rows[i].postIdDetail &&
            response.rows[i].postIdDetail.indexOf('name') == -1
          ) {
            response.rows[i].postIdDetail =
              process.env.VUE_APP_BASE_API + '/api/images/showLocal?name=' +
              response.rows[i].postIdDetail;
          }
        }
        this.recruitList = response.rows;
        // classNo: response.rows.classNo && response.rows.classNo < 7 ? classNoMap.get(response.rows.classNo) : '/';
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm');
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = '添加纳新申请';
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getRecruit(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = '修改纳新申请';
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateRecruit(this.form).then(response => {
              if (response.code == 200) {
                this.$modal.msgSuccess('修改成功');
                this.open = false;
                this.getList();
              }
            });
          } else {
            addRecruit(this.form).then(response => {
              if (response.code == 200) {
                this.$modal.msgSuccess('新增成功');
                this.open = false;
                this.getList();
              }
            });
          }
        }
      });
    },
    /** 停止招新操作 */
    stopRecruit(id, name) {
      const ids = id || this.ids;
      this.$modal
        .confirm('是否确认停止招新"' + name + '"的数据项？')
        .then(function () {
          return stopRecruit(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess('操作成功');
        })
        .catch(() => {});
    },
    /** 删除按钮操作 */
    handleDelete(id, name) {
      const ids = id || this.ids;
      this.$modal
        .confirm('是否确认删除"' + name + '"的数据项？')
        .then(function () {
          return delRecruit(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess('删除成功');
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download(
        'hd/recruit/export',
        {
          ...this.queryParams,
        },
        `recruit_${new Date().getTime()}.xlsx`
      );
    },
    /** 多选框选中数据 */
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** ----------------- */
    orgInfoArrList(val) {
      // if (val !== '') {
      var query = { orgName: val };
      this.searchLoading = true;
      FindOrgInfoByStudentId(query).then(response => {
        this.searchLoading = false;
        this.orgInfoArr = response.data;
      });
      // } else {
      //   this.orgInfoArr = [];
      // }
    },
    addChangeOrg(item) {
      console.log(item, 'item');
      this.form1.orgName = item.orgName;
      this.form1.organizationId = item.orgId;
      this.form1.units = item.unitName;
      this.form1.teacherId = item.teacherId;
      this.form1.classNo = item.classNo;
    },
    /** 1.申请 */
    handleApply() { 
      this.reset1();
      var studentId;
      this.form1.studentId = this.$store.state.user.name;
      FindNickName(this.form1.studentId).then(response => {
        this.form1.studentManage = response.msg;
      });
      FindSponsorInfoByStudentId().then(response => {
        this.sponsorInfoArr = response.rows;
      });

      // -----------------
      this.open1 = true;
      // this.$nextTick(() => {
      //   if (editor == null) {
      //     // && editor2 == null
      //     //  -----------------------------------------------------------------------------
      //     editor = new E('#richText');
      //     // editor2 = new E('#richText2');
      //     editor.create();
      //     // editor2.create();
      //     //开启debug模式
      //     editor.config.debug = true;
      //     // editor2.config.debug = true;
      //     // 关闭粘贴内容中的样式
      //     editor.config.pasteFilterStyle = false;
      //     // editor2.config.pasteFilterStyle = false;
      //     // 忽略粘贴内容中的图片
      //     editor.config.pasteIgnoreImg = false;
      //     // editor2.config.pasteIgnoreImg = false;
      //     // 使用 base64 保存图片
      //     // editor.customConfig.uploadImgShowBase64 = true
      //     // 上传图片到服务器
      //     editor.config.uploadFileName = 'file'; //设置文件上传的参数名称
      //     editor.config.uploadImgServer = process.env.VUE_APP_BASE_API + '/api/images/uploadLocal'; //设置上传文件的服务器路径
      //     editor.config.uploadImgMaxSize = 10 * 1024 * 1024; // 将图片大小限制为 3M
      //     editor.config.uploadImgMaxLength = 5;
      //     editor.config.uploadImgHooks = {
      //       success: function (xhr, editor, result) {
      //         // 图片上传并返回结果，图片插入成功之后触发
      //         // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象，result 是服务器端返回的结果
      //       },
      //       fail: function (xhr, editor, result) {
      //         // 图片上传并返回结果，但图片插入错误时触发
      //         // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象，result 是服务器端返回的结果
      //       },
      //       error: function (xhr, editor) {
      //         // 图片上传出错时触发
      //         // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象
      //       },
      //     };
      //     //  -----------------------------------------------------------------------------
      //   }
      //   // 清除内容
      //   editor.txt.html('');
      //   // editor2.txt.html('');
      // });
    },
    // 批量审核
    submitFormBatch() {
      if (this.ids.length > 0) {
        this.reset();
        this.open8 = true;
        console.log(this.ids, 'ids');
        this.title = '纳新申请批量审核';
      } else {
        this.$modal.msgError('请选择！');
      }
    },
    changePostIdImage(file, fileList) {
      console.log(file.code);
      if (file.status === 'success') {
        this.form1.postId = file.response.data.url;
        this.form2.postId = file.response.data.url;
        this.postIdFileList = fileList;
      }
    },
    changePostIdImage2(file, fileList) {
      console.log(file.code);
      if (file.status === 'success') {
        this.form1.postIdDetail = file.response.data.url;
        this.form2.postIdDetail = file.response.data.url;
        this.postIdFileList2 = fileList;
      }
    },
    removePostIdImage() {
      this.form1.postId = null;
      this.form2.postId = null;
      this.postIdFileList = [];
    },
    removePostIdImage2() {
      this.form1.postIdDetail = null;
      this.form2.postIdDetail = null;
      this.postIdFileList2 = [];
    },
    handleUploadError() {
      this.$modal.msgError('上传失败');
    },
    handleUploadSuccess(res) {
      console.log(res, 'resssss');
      if (res.code == 200) {
        this.$modal.msgSuccess('上传成功');
      } else {
        this.$modal.msgError('上传失败');
      }
    },
    /** 1.申请提交 */
    submitForm1() {
      // this.form1.feature = this.form1.feature + ' #' + this.form1.feature2;
      // 这个地方需要手动赋值
      // this.form1.orgIntroduce = editor.txt.html();
      // this.form1.orgWorkIntroduce = editor2.txt.html();
      this.$refs['form1'].validate(valid => {
        if (valid) {
          RecruitApply(this.form1).then(response => {
            if (response.code == 200) {
              this.$modal.msgSuccess('申请成功');
              this.open1 = false;
              this.getList();
            }
          });
        }
      });
    },
    /** 2.修改 */
    edit(row) {
      this.form2 = { ...row };

      this.postIdFileList = row.postId
        ? [{ name: GetUrlString(row.postId, 'name'), url: row.postId }]
        : [];
      this.postIdFileList2 = row.postIdDetail
        ? [{ name: GetUrlString(row.postIdDetail, 'name'), url: row.postIdDetail }]
        : [];
      // if (row.postId && row.postId.indexOf('?') != -1) {
      //       let obj = {};
      //       let arr = row.postId
      //         .slice(row.postId.indexOf('?') + 1)
      //         .split('&');
      //       arr.forEach(item => {
      //         let param = item.split('=');
      //         obj[param[0]] = param[1];
      //       });
      //       this.form2.postId = obj.name;
      //       console.log(this.form2.postId,"postId")
      //     }

      //  -----------------------------------------------------------------------------
      // this.$nextTick(() => {
      //   if (!editor3) {
      //     editor3 = new E('#richText3');
      //     // editor4 = new E('#richText4');
      //     editor3.create();
      //     // editor4.create();
      //     //开启debug模式
      //     editor3.config.debug = true;
      //     // editor4.config.debug = true;
      //     // 关闭粘贴内容中的样式
      //     editor3.config.pasteFilterStyle = false;
      //     // editor4.config.pasteFilterStyle = false;
      //     // 忽略粘贴内容中的图片
      //     editor3.config.pasteIgnoreImg = false;
      //     // editor4.config.pasteIgnoreImg = false;
      //     // 使用 base64 保存图片
      //     //editor.customConfig.uploadImgShowBase64 = true
      //     // 上传图片到服务器
      //     editor3.config.uploadFileName = 'file'; //设置文件上传的参数名称
      //     editor3.config.uploadImgServer = process.env.VUE_APP_BASE_API + '/api/images/uploadLocal'; //设置上传文件的服务器路径
      //     editor3.config.uploadImgMaxSize = 10 * 1024 * 1024; // 将图片大小限制为 3M
      //     editor3.config.uploadImgMaxLength = 5;
      //     editor3.config.uploadImgHooks = {
      //       success: function (xhr, editor, result) {
      //         // 图片上传并返回结果，图片插入成功之后触发
      //         // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象，result 是服务器端返回的结果
      //       },
      //       fail: function (xhr, editor, result) {
      //         // 图片上传并返回结果，但图片插入错误时触发
      //         // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象，result 是服务器端返回的结果
      //       },
      //       error: function (xhr, editor) {
      //         // 图片上传出错时触发
      //         // xhr 是 XMLHttpRequst 对象，editor 是编辑器对象
      //       },
      //     };
      //   }
      //   // 赋值
      //   editor3.txt.html(this.form2.orgIntroduce);
      //   // editor4.txt.html(this.form2.orgWorkIntroduce);
      // });
      //  -----------------------------------------------------------------------------
      this.open2 = true;
    },
    /** 2.修改提交 */
    submitForm2() {
      // this.form2.feature = this.form2.feature + ' #' + this.form2.feature2;
      // this.form2.orgIntroduce = editor3.txt.html();
      // this.form2.orgWorkIntroduce = editor4.txt.html();

      this.form2.status = 0;
      this.$refs['form2'].validate(valid => {
        if (valid) {
          RecruitDetailsEdit(this.form2).then(response => {
            if (response.code == 200) {
              this.$modal.msgSuccess('修改成功');
              this.open2 = false;

              this.getList();
              this.reload();
            }
          });
        }
      });
    },
    /** 3.查看 */
    look(row) {
      this.form2_1 = row;
      this.open2_1 = true;
    },
    /** 4.审核 */
    audit(row) {
      this.reset3();
      this.form3 = { ...row };
      this.open3 = true;
    },
    /** 4.审核提交 */
    submitForm3(item, batch) {
      this.$refs['form3'].validate(valid => {
        if (valid) {
          if (this.form3.checks != null) {
            if (batch) {
              console.log(batch, '多个审核');
              updateStatusBatch(this.ids, this.form3.checks, this.form3.remarks).then(response => {
                if (response.code == 200) {
                  this.$modal.msgSuccess('审核成功');
                  this.open3 = false;
                  this.getList();
                }
              });
            } else {
              console.log('单个审核');
              updateStatus(this.form3.id, this.form3.checks, this.form3.remarks).then(response => {
                if (response.code == 200) {
                  this.$modal.msgSuccess('审核成功');
                  this.open3 = false;
                  this.getList();
                }
              });
            }
          } else {
            this.$modal.msgWarning('审核结果不能为空');
          }
        }
      });
    },
    /** 5.二维码 */
    code(row) {
      this.title = row.orgName;
      // 查询组织Id
        showQrCode(row.organizationId).then(response => {
          if (response.code == 200) {
            // this.$modal.msgSuccess('二维码已生成');
            this.QRCodeImage = response.msg;

            this.QRCode = true;
          }
          // this.$router.push({ path: '/hd/recruit/form', query: { orgId: this.orgId } });
        });
    },
    // 下载二维码
    openUrl(fileName, title) {
      const url = fileName.replace('http', 'https'); //图片的https链接
      console.log(url, 'url');
      const imgName = url.substr(url.lastIndexOf('/') + 1);
      downloadImgs({
        url: url,
      }).then(res => {
        let href = window.URL.createObjectURL(new Blob([res])); // 根据后端返回的url对应的文件流创建URL对象
        const link = document.createElement('a'); //创建一个隐藏的a标签
        link.style.display = 'none';
        link.href = href; //设置下载的url
        link.download = imgName; //设置下载的文件名
        document.body.appendChild(link);
        link.click();
        document.body.removeChild(link);
        window.URL.revokeObjectURL(href); // 释放掉blob对象
      });
    },
    handleImport(orgId) { 
      this.upload.title = '用户导入';
      this.upload.open = true;
      this.upload.orgId = orgId;
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download(
        '/hd/apply/importTemplate',
        {},
        `apply_template_${new Date().getTime()}.xlsx`
      );
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert(
        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
          response.msg +
          '</div>',
        '导入结果',
        { dangerouslyUseHTMLString: true }
      );
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
  },
};
</script>

<style lang="less" scoped>
.body {
  height: 500px;
  .editor {
    height: 250px;
  }
  .button {
    margin-left: 50%;
    margin-top: 50px;
  }
}
table{ 
table-layout:fixed; 
}
.myNote {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 9;
  height: 193px;
}
</style>
